// App.vue
<template>
  <el-config-provider :locale="zhCn">
    <router-view />
  </el-config-provider>
</template>

<script setup lang="ts">
  import { ElConfigProvider } from 'element-plus'
  import zhCn from 'element-plus/lib/locale/lang/zh-cn'
  import { getUserInfo } from '@/api/use'
  import { useStore } from 'vuex'
  const store = useStore()
  // 用户个人信息的初始化
  let userId: any = ''
  if (localStorage.getItem('userId')) {
    userId = localStorage.getItem('userId')
  } else {
    userId = '1'
    localStorage.setItem('userId', '1')
    store.commit('setUserInfo', {
      userId: 1
    })
  }

  getUserInfo(userId).then(res => {
    store.commit('setUserInfo', res)
  })
</script>
